package com.iamk.util;

import java.io.File;
import java.util.ArrayList;

public class ListFilesUtil {
	
    public ArrayList<String> arrAllFile = new ArrayList<String>();
    public ArrayList<String> arrFileName = new ArrayList<String>();
    public void listAllFiles(String directoryName){
        File directory = new File(directoryName);
 
        //get all the files from a directory
        File[] 	fList = directory.listFiles(ExtensionsFilter.IMAGE_FILTER);
//        File[] 	fList = directory.listFiles(ExtensionsFilter.DATA_FILTER);
 
        for (File file : fList){
            if (file.isFile()){
//              System.out.println(file.getAbsolutePath());
//            	System.out.println(file.getName());
                arrAllFile.add(file.getAbsolutePath());
                arrFileName.add(file.getName());
            } else if (file.isDirectory()){
                listAllFiles(file.getAbsolutePath());
            }
        }
    }
    
    public String[] convertToArrayString(ArrayList<String> arr){
    	String[] arrResult = new String[arr.size()];
    	for(int i = 0; i < arr.size(); i++){
    		arrResult[i] = arr.get(i);
    	}
    	return arrResult;
    }
}
